#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 3e5 + 5;

int n, m;
int a[N], b[N];

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n;
  rep(i, 1, n) cin >> a[i];
  rep(i, 1, n) b[i] = a[i];
  sort(b + 1, b + n + 1);
  int id = 0;
  rep(i, 1, n) {
    if (a[i] < a[id]) continue;
    int x = upper_bound(b + 1, b + n + 1, a[i]) -
            lower_bound(b + 1, b + n + 1, a[i]);
    if (x == 1) id = i;
  }
  if (id == 0) id = -1;
  cout << id;
  return 0;
}